﻿using System;
using System.Collections.Generic;

using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Text;
using System.Data.OleDb;

namespace Web_HengliSeed.Sys_Manage
{
    public partial class M_InformationEdit : System.Web.UI.Page
    {
        //about1，董事长致辞,about2,企业简介,about3,组织机构,about4,发展规划,about5,企业荣誉,about6,企业文化,about7,联系我们,about8,人才战略
        private string m_type = string.Empty;
        private string m_lan = string.Empty;

        protected void Page_Load(object sender, EventArgs e)
        {
            ClassFile.Function.CheckState();
            m_type = Request["type"];
            m_lan = Request["lan"];
            if (!IsPostBack)
            {
                LoadData();
            }
        }

        private void LoadData()
        {
            OleDbDataReader red = BLL.Information.GetInformation(m_type, m_lan);
            if (red != null)
            {
                while (red.Read())
                {
                    txt_CompanyAbout.Value = Server.HtmlDecode(red["T_Content"].ToString());
                }
                red.Close();
                red.Dispose();
            }
        }

        protected void BtnSave_Click(object sender, EventArgs e)
        {
            StringBuilder str = new StringBuilder(Server.HtmlEncode(txt_CompanyAbout.Value.Trim()));
            if (BLL.Information.UpdateInformation(m_type, m_lan, str.ToString()))
            {
                Common.ShowMessage.Show(Page, "Suess", "信息保存成功...");
            }
            else
            {
                Common.ShowMessage.Show(Page, "Suess", "信息保存失败，请重试或联系技术人员...");
            }
        }

        public string GetTitle()
        {
            switch (m_type.ToLower())
            {
                case "about1":
                    return "董事长致辞";
                case "about2":
                    return "企业简介";
                case "about3":
                    return "组织机构";
                case "about4":
                    return "发展规划";
                case "about5":
                    return "企业荣誉";
                case "about6":
                    return "企业文化";
                case "about7":
                    return "联系我们";
                case "about8":
                    return "人才战略";
                case "service":
                    return "客服中心";
                case "job":
                    return "人才战略";
                case "jobs":
                    return "公司招聘";
                default:
                    return string.Empty;
            }
        }
    }
}